package com.mall.huohuo.service;/**
 *
 */

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.mall.huohuo.datasource.entity.TblDistributedIdSetting;
import com.mall.huohuo.datasource.mapper.TblDistributedIdSettingMapper;
import com.mall.huohuo.service.home.domain.Banner;
import com.mall.huohuo.service.home.service.BannerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

@Service
@Slf4j
public class BannerServiceImpl implements BannerService {
    /**
     * 获取
     */
    @Autowired
    private TblDistributedIdSettingMapper tblDistributedIdSettingMapper;

    @Override
    public List<Banner> getBannerList() {
        final List<TblDistributedIdSetting> tblDistributedIdSettings =
                tblDistributedIdSettingMapper.selectList(Wrappers.emptyWrapper());
        System.out.println(JSONObject.toJSONString(tblDistributedIdSettings));
        Banner banner = new Banner().setId(ThreadLocalRandom.current().nextLong()).setImage("http://picasso.alicdn.com/imgextra/i2/356114/O1CNA1JuHdoI100e8ce8bf180b0fa8130005_!!356114-0-picassobanner.jpg");
        Banner banner1 = new Banner().setId(ThreadLocalRandom.current().nextLong()).setImage("https://aecpm.alicdn.com/simba/img/TB1CWf9KpXXXXbuXpXXSutbFXXX.jpg_q50.jpg");
        return Lists.newArrayList(banner, banner1);
    }
}
